.checkbox {
  position: relative;
  z-index: var(--z-index-1);
  display: flex;
  gap: var(--space-8);
}

.disabled,
.disabled * {
  cursor: not-allowed;
}

.input {
  position: absolute;
  z-index: var(
    --z-index-1
  ); /* stack `.input` over all other elements within `.checkbox` */
  top: calc(-1 * var(--space-8));
  right: calc(-1 * var(--space-8));
  bottom: calc(-1 * var(--space-8));
  left: calc(-1 * var(--space-8));
  display: block;
}

.box {
  position: relative;
  width: var(--space-16);
  height: var(--space-16);
  border: var(--border-width-1) solid var(--figma-color-border);
  border-radius: var(--border-radius-4);
  background-color: var(--figma-color-bg-secondary);
}
.checkbox:not(.disabled) .input:focus-visible ~ .box {
  box-shadow: 0 0 0 var(--border-width-1) var(--figma-color-bg) inset;
}
.checkbox:not(.disabled) .input:focus ~ .box {
  border-color: var(--figma-color-border-selected);
}
.checkbox:not(.disabled) .input:checked ~ .box,
.checkbox:not(.disabled) .input:indeterminate ~ .box {
  border-color: var(--figma-color-border-brand-strong);
  background-color: var(--figma-color-bg-brand);
}

.disabled .input ~ .box {
  background-color: transparent;
}
.disabled .input:checked ~ .box,
.disabled .input:indeterminate ~ .box {
  border-color: transparent;
  background-color: var(--figma-color-bg-disabled);
}

.icon {
  position: absolute;
  top: calc(-1 * var(--border-width-1));
  left: calc(-1 * var(--border-width-1));
  color: var(--figma-color-icon-onbrand);
}

.children {
  flex: 1;
  padding-top: var(--space-4);
  color: var(--figma-color-text);
}
.disabled .children {
  opacity: var(--opacity-30);
}
